package com.yunc.modules.chat.entity;

import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import java.util.Date;
import java.io.Serializable;

import com.yunc.modules.sys.entity.SysUser;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;

/**
 * 聊天记录表
 * 定期移除消息至只读表中，实现读写分离
 *
 * @author concong tao
 * @since 2019-03-28
 */
@Data
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
@TableName("chat_messages")
public class ChatMessages implements Serializable {

    private static final long serialVersionUID = 1L;

    @TableId(type = IdType.AUTO)
    private Long id;

    /**
     * 消息内容
     */
    private String postMessage;

    /**
     * type类型1=普通消息2=好友申请消息
     */
    private String type;

    /**
     * 普通消息：接受状态，默认未读取1，已读取2
     * 好友申请消息：1未读取2接受请求3拒绝请求
     */
    private String status;

    /**
     * 发送时间
     */
    private Date sendTime;

    /**
     * 发送者ID
     */
    private Long fromUserId;

    /**
     * 接受者ID
     */
    private Long toUserId;

    private Long fromGroupId;

    @TableField(exist = false)
    private SysUser user;

    @TableField(exist = false)
    private SysUser toUser;
}
